﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Data.OleDb;
using System.Text;
using System.Windows.Forms;
using System.Speech;
using System.Speech.Synthesis;



namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        SpeechSynthesizer synth = new SpeechSynthesizer();
        
        public Form1()
        {
            InitializeComponent();
        }

        

        private void btngreen_Click(object sender, EventArgs e)
        {
              SpeechSynthesizer synthesizer = new SpeechSynthesizer();
            synthesizer.Speak("this text is good enough to send");
        }

        private void btnyellow_Click(object sender, EventArgs e)
        {
         SpeechSynthesizer synthesizer = new SpeechSynthesizer();
            synthesizer.Speak("this mail is moderately offensive kindly recheck your mail");
        }

        private void btnred_Click(object sender, EventArgs e)
        {
            SpeechSynthesizer synthesizer = new SpeechSynthesizer();
            synthesizer.Speak("this mail is rude. kindly refrain from sending");
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\dev\msc project\Creating a simple plugin mechanism\Database\Profanity.accdb;
Persist Security Info=False;";
            connection.Open();
            MessageBox.Show("welcome to the grid");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (richTextBox1.Text!="")
            {
                synth.Dispose();
                synth = new SpeechSynthesizer();
                synth.SpeakAsync(richTextBox1.Text);
            }
            else
            {
                
                MessageBox.Show("enter data into Suresh's grid");
            }
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            if(synth!=null)
            {
                if(synth.State==SynthesizerState.Speaking)
                {
                    synth.Pause();
                }
            }
                
            }

        private void button2_Click(object sender, EventArgs e)
        {
            if (synth != null)
            {
                if (synth.State == SynthesizerState.Paused)
                {
                    synth.Resume();
                }
        }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (synth != null)
            {
                synth.Dispose();
            }
        }
        

      

       
    }
}
